import request from '@/utils/request'
import { getToken } from '@/utils/storage'

//获取面经页面数据

export const getArticles = (data) => {
    const token = getToken()
    return request.get('/interview/query', {
        params: {
            current: data.current,
            pageSize: data.pageSize,
            sorter: data.sorter
        },
        headers: {
            Authorization: `Bearer ${token}`
        }
    })

}

//获取单个面经页面详情
export const getDetail = (id) => {
    return request.get('/interview/show', {
        params: {
            id
        }
    })
}

//点赞
export const updateLike = (id) => {
        return request.post('/interview/opt', {

            id,
            optType: 1

        })
    }
    //收藏
export const updateCollect = (id) => {
    return request.post('/interview/opt', {

        id,
        optType: 2

    })
}


//收藏页面
export const getArticlesCollect = (obj) => {
    return request.get('/interview/opt/list', {
        params: {
            optType: 2, //表示收藏
            pageSize: 5, //可选
            page: obj.page //当前页
        }
    })
}

//点赞页面
export const getArticlesLike = (obj) => {
    return request.get('/interview/opt/list', {
        params: {
            optType: 1, //表示喜欢
            pageSize: 5, //可选
            page: obj.page //当前页
        }
    })
}